﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ServiceModel;
using System.ServiceModel.Web;
using Top.Api.Domain;
using AscentTopLibrary;

namespace AscentExplorer.Web.Areas.Top.Services
{
    [ServiceContract]
    public class TopRestService
    {
        [WebGet(UriTemplate = "trades")]
        public IEnumerable<Trade> GetTrades()
        {
            using (var db = new TopDbContext("TopDbContext"))
            {
                return db.Trades.ToList();
            }            
        }

        [WebGet(UriTemplate = "items")]
        public IEnumerable<Item> GetItems()
        {
            using (var db = new TopDbContext("TopDbContext"))
            {
                return db.Items.ToList();
            }
        }
    }
}